Refresh objects not module?

By any chance is there a way to refresh a single object at a time, such as running a script in attribute DXL and having that value update the object in the current module? As I've read a number of times in this forum, it seems that one has to scroll through the module to update the individual object contents after a Refresh DXL Attributes or similar function.

Alternatively, is there a quick and easy way to force the module to scroll and update, rather than manually using the scroll bar?

I can't seem to refresh the module or use any other feature to catch, and more importantly save, a change that is incurred via Attribute DXL unless I scroll through the module before closing/saving.

One barrier is that I cannot change each object - only the attribute values changed by the Attribute DXL can be saved as changes to the module.
SystemAdmin - Thu Sep 30 12:17:24 EDT 2010

Re: Refresh objects not module?
llandale - Wed Oct 06 15:22:19 EDT 2010

When you say 'refresh' this post assumes you mean 'force re-calculation of the attribute DXL for all objects in the module'.

First off, the attr values are not saved in the module. Attr-DXL is calculated the first time the value is needed, after either of these two events [1] The module is opened [2] the attr-dxl value in question is set to null. Note that these attr values are calculated and apparently 'stored' even for modules open Read; and the values can be 'set to null' even when open Read. If you open a view that displays some attr-DXL then those objects that are viewed will have their attr-DXL calculated. As you scroll down, more and more values are calculated. If you scroll back up they are not re-calculated since its already been done.

Well, the GUI has a 'refresh DXL attributes' function that is very similar to these functions:

//*************************
void    fRefreshDxlAttrs(Object obj)
{     // Refresh all the DXL attributes for the specified Object
 
        if (null obj) return()
 
        if (isDeleted(obj)                                      and
            length(doorsInfo(infoVersion)) >=7               and 
            (doorsInfo(infoVersion))[0:6] == "9.2.0.1")       return()        // DOORS version 9.2.0.1 bug
        Module  mod = module(obj)
        if (null mod) return()                          // is this possible?
        AttrDef ad
 
        noError()
        for ad in mod do 
        {  if (ad.dxl         and
               ad.object) obj.(ad.name) = ""
        }
        lastError()     // ignore all errors herein
}     // end fRefreshDxlAttrs(Object)
 
//*************************
void    fRefreshDxlAttrs(Module mod)
{     // Refresh all the DXL attributes in the Module
 
        // Developer's note: the "for ad in mod do" loop is very slow,
        //      so this function does NOT loop through objects and call the
        //      above fRefreshDxlAttrs(Object) function (which loops through attrs).
        //      Instead, it first loops through attrs and then through objects.
 
        if (null mod) return
 
        bool    Is9201  = length(doorsInfo(infoVersion)) >=7         and 
                                  (doorsInfo(infoVersion))[0:6] == "9.2.0.1"
 
        string  NameAttr
        Object  obj
        AttrDef ad
 
        noError()
        for ad in mod do 
        {  if (!ad.dxl) continue
    
           NameAttr = ad.name
           if ( ad.object )
           {
              for obj in entire mod do 
              {  if (Is9201 and isDeleted(obj)) continue      // Cannot update deleted object in v9.2.0.1
                 obj.NameAttr = ""
              }
           }
 
           if (ad.module)
           {
              mod.NameAttr = ""
           }
        }
        lastError()     // ignore all errors herein
        refresh(mod)
}    // end fRefreshDxlAttrs(Module)


This doesn't actuall force-recalculation, it just sets the value null and it is recalculated the next time the value is needed, such as if you scroll back down. Those functions are really only needed if you change something somewhere else that would cause the actual calculation to be different. If the attr-DXL counts links and you create a link, you would want to refresh.

There is very little reason you would NEED to have the values calculated for all attr-DXL of all objects in the module. The only reason I can think of is when the attr-DXL is particularly slow and you want to get that out of the way early in some sequence, rather than later; perhaps get it out of the way as you display some dialog box instead of after the user hits some action button. You can do that by writing functions similar to the ones above, but instead of setting it to null you can simply read the value, perhaps 'string Value = obj.NameAttr'. (you an also dispense with the 9.2.0.1 bug and deleted objects part of those functions).

On an important side note: since the value is tagged as to be re-calculated when the value is null, its pretty important that the DXL itself does not set it to null, otherwise it will continue to re-calculate. This means that all your attr-DXL code should have something like this at the bottom:

 

string Results = calculate the results for this 'obj'.
if (null Results) //
then obj.attrDXLName = " "
else obj.attrDXLName = Results


This sets a 'null' results to a space. Any other DXL you write that reads this value will need to be coded to check for null or space; perhaps:

 

 

string AttrValue = objOther.NameSomeOtherAttrDXL
if (null AttrValue   or  AttrValue == " ") //
then deal with null value
else deal with a real value

 

 

  • Louie